#ifndef NEFFUNCS_H
#define NEFFUNCS_H

void nefGLinit()
{
	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_LESS);
	glShadeModel(GL_SMOOTH);
	glEnable(GL_TEXTURE_2D);
	glEnable(GL_LIGHTING);
	glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
}

void Delay_ms(int time)
{
	clock_t now = clock();
	while (clock() - now < (time * 1000))
		;
}

int getFps()
{
	static clock_t now;
	static bool first = true;
	static int fps = 0;
	int n;
	clock_t newt = clock();
	if (first)
	{
		now = clock() - 1;
		first = false;
	}
	n = newt - now;
	if (n == 0)
		n = 1;
	fps = (int)(1000000 / n);
	now = newt;
	return fps;
}

int getRenderFps()
{
	static clock_t now;
	static bool first = true;
	static int fps = 0;
	int n;
	clock_t newt = clock();
	if (first)
	{
		now = clock() - 1;
		first = false;
	}
	n = newt - now;
	if (n == 0)
		n = 1;
	fps = (int)(1000000 / n);
	now = newt;
	return fps;
}

#endif